package com.czy.daishusys.adapter;

import android.support.annotation.Nullable;
import android.view.View;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.czy.daishusys.R;
import com.czy.daishusys.entity.DeliverGoodsModel;
import com.czy.daishusys.utils.MyLog;

import java.util.List;

/**
 * Created by asus on 2017/12/4.
 */

public class DeliverAddressAdapter extends BaseQuickAdapter<DeliverGoodsModel.DataBean.UListBean.AddressListBean,BaseViewHolder>{
    public DeliverAddressAdapter(int layoutResId, @Nullable List<DeliverGoodsModel.DataBean.UListBean.AddressListBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder holder, DeliverGoodsModel.DataBean.UListBean.AddressListBean item) {
        TextView   tvDeliverAddresNum =(TextView) holder.getView(R.id.tv_deliver_address_num);
        TextView   tvDeliverAddresDefault = (TextView)holder.getView(R.id.tv_deliver_address_default);
        TextView    tvDeliverAddresDetail = (TextView)holder.getView(R.id.tv_deliver_address_detail);
        int position = getParentPosition(item)+getHeaderLayoutCount()+getFooterLayoutCount();
        if (position==0){
            tvDeliverAddresDefault.setVisibility(View.VISIBLE);
        }
        else {
            tvDeliverAddresDefault.setVisibility(View.GONE);
        }
        MyLog.e("asus",position+"");
        tvDeliverAddresNum.setText("地址"+(position+1));
        tvDeliverAddresDetail.setText(item.getProvinceName() + item.getCityName() + item.getAreaName() + item.getDetailLocation());
    }
}